home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacHack 1998
/
MacHack 1998.toast
/
Sessions
/
STL
/
Slides
/
STL3.cp
< prev
next >
Wrap
Text File
|
1998-06-15
|
656b
|
37 lines
// STL3.cp
#include <iostream>
#include <list>
using namespace std;
int main()
{
typedef list<char> MyList;
char start[] = "machack";
MyList l(start, start + strlen(start));
ostream_iterator<char> out(cout);
cout << " start: ";
copy(l.begin(), l.end(), out);
cout << "\nremoved: ";
l.remove('c');
copy(l.begin(), l.end(), out);
cout << "\n sorted: ";
l.sort();
copy(l.begin(), l.end(), out);
cout << "\n unique: ";
l.unique();
copy(l.begin(), l.end(), out);
cout << "\nreverse: ";
l.reverse();
copy(l.begin(), l.end(), out);
cout << "\n";
}
// start: machack
// removed: mahak
// sorted: aahkm
// unique: ahkm
// reverse: mkha